<template>
  <div>
    <input v-model="title" @mouseover="search1" @mouseleave="search2">
    <button @click="search">搜索</button>
    <ul>
      <li v-for='i in list'>{{ i.title }}</li>
    </ul>
    <h3>展示联想记录</h3>
    <ul>
      <li v-for='i in lxlist'>{{ i.title }}--{{ i.id }}</li>
    </ul>
    <h3>展示搜索记录</h3>
    <ul>
      <li v-for='i in sslist'>{{ i.title }}--{{ i.id }}</li>
    </ul>

    <h1>所有商品表</h1>
    <ul v-for="i in list1">
      <li>
        <a :href="'/#/comm?id=' + i.id"><button>{{ i.title }}</button></a>
      </li>
    </ul>
  </div>
</template>
<script>
export default {
  data() {
    return {
      list1: [],
      title: '',
      list: [],
      lxlist: [],
      sslist: [],
    }
  },
  methods: {
    search() {
      this.axios.get('search?title=' + this.title).then(res => {
        if (res.data.code == 10030) {
          alert(res.data.mes)
          this.list = res.data.list
        }
      })
    },
    search1() {
      this.axios.get('show?title=' + this.title).then(res => {
        this.lxlist = res.data.lxlist
      })
    },
    search2() {
      this.axios.get('show?title=' + this.title).then(res => {
        this.sslist = res.data.sslist
      })
    },
    getlist() {
      this.axios.get('goods').then(res => {
        this.list1 = res.data.list
      })
    }


  },
  mounted() {
    this.getlist()
  }
}
</script>
<style lang="">

</style>
<!--<template>-->
<!--  <div>-->
<!--    <van-field label='手机号' v-model='mobile'/>-->
<!--    <van-button @click='send'>发送验证码</van-button>-->
<!--    <van-field label='验证码' v-model='code'/>-->
<!--    <van-button @click="login">登录</van-button>-->

<!--  </div>-->
<!--</template>-->

<!--<script>-->
<!--export default {-->
<!--  name: "login",-->
<!--  data() {-->
<!--    return {-->
<!--      mobile: '',-->
<!--      code: ''-->
<!--    }-->
<!--  },-->

<!--  methods: {-->
<!--    send() {-->
<!--      this.axios.post('sendSms', {'mobile': this.mobile}).then(res => {-->
<!--        alert(res.data.mes)-->
<!--      })-->
<!--    },-->
<!--    login() {-->
<!--      this.axios.post('tlogin', {'mobile': this.mobile, 'code': this.code}).then(res => {-->
<!--        alert(res.data.meslist)-->
<!--      })-->
<!--    }-->
<!--  },-->

<!--  mounted() {-->

<!--  }-->
<!--}-->
<!--</script>-->

<!--<style scoped>-->

<!--</style>-->
